/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUIComponents.Menu;

import MainClasses.main;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
/**
 *
 * @author andrewcutler
 */
public class DayMenu extends JMenu{
    
    public DayMenu()
    {
        super("Day");
        JMenuItem nextweek = new JMenuItem("Next Week");
        nextweek.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                main.addOffset(7);
                main.resetTabbedPane();
            }
            });
            
        JMenuItem next = new JMenuItem("Next Day");
        next.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                main.addOffset(1);
                main.resetTabbedPane();
            }
            });
            
        JMenuItem today = new JMenuItem("Today");
        today.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                main.setOffset(0);
                main.resetTabbedPane();
            }
            });
            
        JMenuItem previous = new JMenuItem("Previous Day");
        previous.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                main.addOffset(-1);
                main.resetTabbedPane();
            }
            });
            
        JMenuItem previousweek = new JMenuItem("Previous Week");
        previousweek.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                main.addOffset(-7);
                main.resetTabbedPane();
            }
            });
            
            
        
        nextweek.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK + KeyEvent.ALT_MASK));
        next.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK));
        today.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK));
        previous.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK));
        previousweek.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK + KeyEvent.ALT_MASK));
        
        
        add(nextweek);
        add(next);
        add(today);
        add(previous);
        add(previousweek);
        
    }

}
